@extends('layouts.student')

@section('content')
<style type="text/css">
.delegate{margin:10px;}
</style>
<div class="page-content">

    <div class="row">

        <div class="col-xs-12">
            
                <h1 style="text-align: center; margin-top: 50px;">{{ $template->title }}</h1>
                <hr>
                <div id="date" style="text-align: right;">
                    {{ $template->updated_at }}
                </div>
                <a href="/download/templates/{{$template->body}}" target="_blank">模板</a>
                </div>
        
        </div>
    </div>
</div>
<script src="/assets/js/jquery.base64.js"></script>
<script type="text/javascript">

jQuery(function($){
    $('#content').html($.base64.atob("{{$template->body}}", true));
});

function html_decode(str) {
    var s = "";
    if (str.length == 0)
        return "";
    s = str.replace(/>/g, "&");
    s = s.replace(/</g, "<");
    s = s.replace(/>/g, ">");
    s = s.replace(/ /g, " ");
    s = s.replace(/'/g, "\'");
    s = s.replace(/"/g, "\"");
    s = s.replace(/<br>/g, "\n");
    return s;
}
</script>
@endsection